package com.dingli.servlet;

import com.dingli.DAO.queryTicketDAO;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(urlPatterns = {"/index"})
public class IndexServlet extends HttpServlet {
    static int count = 0;

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        queryTicketDAO queryTicketDAO = new queryTicketDAO();
        count = queryTicketDAO.queryCount();
        req.setAttribute("count", count);
        req.getRequestDispatcher("/views/index.jsp").forward(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String start = request.getParameter("cur");
        String end = request.getParameter("end");
        System.out.println(start+end);
    }

}


